package mianshi.threesix;

import java.util.Scanner;

public class T2 {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int q = scanner.nextInt();
        int[][] data = new int[q][2];
        int[] res = new int[q];

        for (int i = 0; i < q; i++) {
            data[i][0] = scanner.nextInt();
            data[i][1] = scanner.nextInt();
        }
        res[0] = n-(data[0][1]-data[0][0]+1);

        for (int i = 1; i < q; i++) {
            res[i] = res[i-1]-(Math.abs(data[i][1]-data[i-1][1]))+(Math.abs(data[i][0]-data[i-1][1])+1);
        }


        for (int i = 0; i < q; i++) {
            System.out.println(res[i]);
        }

    }
}
